﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<QLPKWeb.Models.FormBean.DanhMucChungModel.KhachHangForm>" %>

<%@ Import Namespace="QLPKWeb.Models.LinQ.DanhMucChung" %>
<%@ Import Namespace="Webdiyer.WebControls.Mvc" %>
<%@ Import Namespace="DONGACS.DTO" %>
<%@ Import Namespace="System.Web.Mvc.Html" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript" language="javascript" src="<%= ResolveUrl("~/Content/Scripts/DanhMucChung/KhachHang.js") %>"></script>
    
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            $("#KhachHangSearch").focus();
        });
        $(document).ready(function () {
            selectMenu("danhmucchung-KhachHang");
            $("#danhmucchung-KhachHang").parent().attr("class", "expanded");
        });
        function ImportExcel() {
            $("#form").attr("action", basePath + "DanhMucChung/ReadAndSaveExcel");
            $("#form").attr("method", "post");
            $("#form").submit();
        }

    </script>
    
    <form id="form" enctype="multipart/form-data" method="post" action="#" >
    
    <input type="hidden" id="Id" name="Id" value="<%=Model.Id %>"/>
    <%=Html.Hidden("PageNumber", Model.PageNumber)%>

     <div class="box round first fullpage">
            <h2>Nhà cung cấp</h2>
		<div class="box round first grid" style="border: 1px solid #ddd ">
                      <h2>Danh sách đơn vị</h2>
            <table class="data display datatable">
                <tr>
                    <td colspan="4"> Import file : <input type="file" id="UploadControl" name="UploadControl"/> <input type="button" name="importExcel" id="importExcel" value="Import Execl" onclick="ImportExcel()"/> </td>
                </tr> 
                <tr>
                    <td colspan="4" style="padding-top:10px;" >
                        <table cellspacing="0" cellpadding="0"class="data display datatable">
                            <tr class="title">
                                <td style="border: 1px solid #ddd "class="first" width="20%" align="center">
                                    <strong>ID</strong>
                                </td>
                                <td style="border: 1px solid #ddd "class="last">
                                    <strong>Tên Khách hàng</strong>
                                </td>    
                                  <td style="border: 1px solid #ddd "class="last">
                                    <strong>Địa chỉ</strong>
                                </td>     
                                  <td style="border: 1px solid #ddd "class="last">
                                    <strong>Số ĐT </strong>
                                </td>  
                                  <td style="border: 1px solid #ddd "class="last">
                                    <strong>Fax </strong>
                                </td>
                                 <td style="border: 1px solid #ddd "class="last">
                                    <strong>Email </strong>
                                </td>                                    
                            </tr>
                            <%--Danhd Muc Đối tác List--%>

                            <%
                                
                            IList<dm_KhachHang> KhachHangList = Model.KhachHangPagedList;

                            foreach (dm_KhachHang item in KhachHangList)
                            {
                            %>
                            <tr class="item_row" onclick="javascript:highlight(this);EditKhachHangAjax(<%=item.Id%>);">
                                <td style="border: 1px solid #ddd "class="first" align="center">
                                    <%=item.Id%>
                                </td>
                                <td style="border: 1px solid #ddd "align="left" class="last">
                                    <%=item.TenKH%>&nbsp;
                                </td>
                                 <td style="border: 1px solid #ddd "align="left" class="last">
                                    <%=item.DiaChi%>&nbsp;
                                </td>
                                 <td style="border: 1px solid #ddd "align="left" class="last">
                                    <%=item.SoDT%>&nbsp;
                                </td>
                                  <td style="border: 1px solid #ddd "align="left" class="last">
                                    <%=item.Fax%>&nbsp;
                                </td>
                                  <td style="border: 1px solid #ddd "align="left" class="last">
                                    <%=item.Email%>&nbsp;
                                </td>

                            </tr>
                            <%}
                            %>
                            <tr class="border_bottom">
                                <td class="first" style="background: #DDDDDD">
                                </td>
                                <td class="last" colspan="7" align="right" style="background: #DDDDDD; padding-right: 10px">
                                     
                                     <%
                                         PagerOptions pagerOptions = new PagerOptions();
                                         QLPKWeb.BussinessDelegate.CommonDelegate.CommonDelegate CommonDelegate
                                             = new QLPKWeb.BussinessDelegate.CommonDelegate.CommonDelegate();
                                         CommonDelegate.ChangeTextPaging(pagerOptions, string.Empty);
                                     %>
                                    <div><%=Html.Pager(Model.KhachHangPagedList, pagerOptions)%></div>
                                    <%=Html.Hidden("PageNumber", Model.PageNumber)%>
                                </td>
                            </tr>
                            <%--dã xóa--%>
                        </table>
                    </td>
                </tr>
            </table>
           </div>

            
            <table class="data display datatable">
                    
                    <tr>
                        <td colspan="2">
                            <%--Thông Báo--%>
                            <%
                                if (!string.IsNullOrEmpty(Model.MessageCreateKhachHang))
                                {
                            %>
                            <div id="MessageCreateKhachHang" style="font-size: 12px; color: Blue; font-weight: bold">
                                <%=Model.MessageCreateKhachHang%></div>
                            <%
                                }
                            %>
                            <%
                                if (!string.IsNullOrEmpty(Model.MessageEditKhachHang))
                                {
                            %>
                            <div id="MessageEditKhachHang" style="font-size: 12px; color: Blue; font-weight: bold">
                                <%=Model.MessageEditKhachHang%></div>
                            <%
                                }
                            %>
                            <%--end--%>
                        </td>
                        <td align="right">
                            <input type="button"class="btn btn-grey" value="Tạo/Cập nhật" onclick="DoCreateOrEdit()" />
                            <input type="button"class="btn btn-grey" value="Tạo mới" onclick="javascript:DoNew();" />
                            <input type="button"class="btn btn-grey" value="Xóa" onclick="javascript:DoDelete();" />
                            <input type="button" class="btn btn-grey"value="Hủy thay đổi" onclick="javascript:DoReset();" />
                        </td>
                    </tr>
                    
                    
                    </table >
                    <table class="data display datatable">
                    <tr>
                        <td style="width: 20%; vertical-align:middle;">
                            <b>Tên </b>
                        </td>
                        <td>
                            <input type="text" size="70" value="<%=Model.TenKH%>" id="TenKH" name="TenKH"/>
                            <div id="TenMessage" class="red"></div>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 20%; vertical-align:middle;">
                            <b>Địa chỉ</b>
                        </td>
                        <td>
                            <input type="text" size="70" value="<%=Model.DiaChi%>" id="DiaChi" name="DiaChi"/>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 20%; vertical-align:middle;">
                            <b>Điện thoại</b>
                        </td>
                        <td>
                            <input type="text" size="70" value="<%=Model.SoDT%>" id="SoDT" name="SoDT"/>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 20%; vertical-align:middle;">
                            <b>Fax</b>
                        </td>
                        <td>
                            <input type="text" size="70" value="<%=Model.Fax%>" id="Fax" name="Fax"/>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 20%; vertical-align:middle;">
                            <b>Email</b>
                        </td>
                        <td>
                            <input type="text" size="70" value="<%=Model.Email%>" id="Email" name="Email"/>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 20%; vertical-align:middle;">
                            <b>WebSite</b>
                        </td>
                        <td>
                            <input type="text" size="70" value="<%=Model.WebSite%>" id="WebSite" name="WebSite"/>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 20%; vertical-align:middle;">
                            <b>MST</b>
                        </td>
                        <td>
                            <input type="text" size="70" value="<%=Model.MaST%>" id="MaST" name="MaST"/>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 20%; vertical-align:middle;">
                            <b>MST</b>
                        </td>
                        <td>
                            <input type="text" size="70" value="<%=Model.MaST%>" id="MaST" name="MaST"/>
                        </td>
                    </tr> 
                    <tr>
                        <td style="width: 20%; vertical-align:middle;">
                            <b>Loai KH</b>
                        </td>
                        <td>
                          <%=Html.DropDownList("IdLoaiKhachHang", Model.SLLoaiKhachHang, new { style = "width:150px;" })%>
                        </td>
                    </tr>
                </table>
           
       <%-- </div>--%>
    </div>
    <%--<%Html.EndForm(); %>--%>

    </form>
</asp:Content>
